home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / examples / dltest2 < prev    next >
Text File  |  1994-08-07  |  675b  |  47 lines

  1. #
  2. # Test dltest2
  3. #
  4.  
  5. rfile ode23
  6. rfile ode4
  7.  
  8. #
  9. # Link in the rhs function (builtin)
  10. #
  11.  
  12. vdpol = dlopen("./dltest2", "VDPolEq")
  13.  
  14. #
  15. # Create a user-function equivilent
  16. #
  17.  
  18. uvdpol = function ( t , x ) 
  19. {
  20.   local(xdot);
  21.  
  22.   xdot[1;1] = x[1] * (1 - x[2]^2) - x[2];
  23.   xdot[2;1] = x[1];
  24.   return xdot;
  25. };
  26.  
  27. t0 = 0;
  28. tf = 100;
  29. x0 = [0; 0.25];
  30.  
  31. tic();
  32. out = ode (vdpol, t0, tf, x0);
  33. printf ("DL ode vdpol time = %f\n", toc());
  34.  
  35. tic();
  36. out = ode (uvdpol, t0, tf, x0);
  37. printf ("UF ode vdpol time = %f\n", toc());
  38.  
  39. tic();
  40. out23 = ode23 (vdpol, t0, tf, x0);
  41. printf ("DL ode23 vdpol time = %f\n", toc());
  42.  
  43. tic();
  44. out23 = ode23 (vdpol, t0, tf, x0);
  45. printf ("UF ode23 vdpol time = %f\n", toc());
  46.  
  47.